﻿@model IEnumerable<NOSDC.Pocos.Article>

@{
    ViewBag.Title = "Index";
}

<h2>Listing of articles</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        
        <th>
            Title
        </th>
        <th>
            Story
        </th>
        <th>
            Date Posted
        </th>
        <th>
            Posted By
        </th>
        <th>
            IP Address
        </th>
        <th>
            Status
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
   
        <td>
            <a href='@Url.Action("Edit", "Articles", new {id=item.ArticleID})'> @item.Title  </a>
        </td>
        <td>
            @item.Story
        </td>
        <td>
            @String.Format("{0:g}", item.DatePosted)
        </td>
        <td>
            @Membership.GetUser(item.PostedBy).UserName
        </td>
        <td>
            @item.IPAddress
        </td>
        <td>
            @NOSDC.Pocos.Status.StatusFlag.GetName(typeof(NOSDC.Pocos.Status.StatusFlag), item.StatusID)
        </td>
             <td>
            <a href='@Url.Action("Edit", "Articles", new {id=item.ArticleID})' style="float:left;padding-right:10px;">
                <img src='@Url.Content("~/Areas/Admin/Images/edit_icon.gif")' alt="Edit" title="Edit" />
            </a>

            @using (Html.BeginForm("Delete", "Articles", new { id = item.ArticleID }, FormMethod.Post, new { style="float:left;"}))
            {
                <input type="image" title="Delete" alt="Delete" src='@Url.Content("~/Areas/Admin/Images/icon-deleteX-transparent.png")' onclick="return confirm('Are you sure you want to delete this article?');" />
            }
        </td>
    </tr>
}

</table>

